using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
using GameStateManagement;


// ****************************************************************************** //
//        Component that handles the input ONLY in menu screens, not ingame       //
// ****************************************************************************** //

namespace Frogger_Game
{
    //inner class we will pass as service to all menu components that need input
    public class InputButtons
    {
        public InputAction menuUp = new InputAction(
          new Buttons[] { Buttons.DPadUp, Buttons.LeftThumbstickUp },
          new Keys[] { Keys.Up },
          true);
        public InputAction menuDown = new InputAction(
           new Buttons[] { Buttons.DPadDown, Buttons.LeftThumbstickDown },
           new Keys[] { Keys.Down },
           true);
        public InputAction menuSelect = new InputAction(
            new Buttons[] { Buttons.A, Buttons.Start },
            new Keys[] { Keys.Enter, Keys.Space },
            true);
        public InputAction menuCancel = new InputAction(
           new Buttons[] { Buttons.B, Buttons.Back },
           new Keys[] { Keys.Escape, Keys.Delete },
           true);
        public InputAction menuRight = new InputAction(
           new Buttons[] { Buttons.DPadRight, Buttons.LeftThumbstickRight },
           new Keys[] { Keys.Right },
           true);
        public InputAction menuLeft = new InputAction(
           new Buttons[] { Buttons.DPadLeft, Buttons.LeftThumbstickLeft },
           new Keys[] { Keys.Left },
           true);
    }

    public class Input : Microsoft.Xna.Framework.GameComponent
    {
        InputState input = new InputState();
       
        InputButtons inputButtons = new InputButtons();

        //main constructor
        public Input(Game game)
            : base(game)
        {
            Game.Services.AddService(typeof(InputState), input);
            Game.Services.AddService(typeof(InputButtons), inputButtons);
        }



        //public void ManualDispose(bool disposing)
        //{
        //    Game.Services.RemoveService(typeof(InputState));
        //    Game.Services.RemoveService(typeof(InputButtons));
        //    base.Dispose(disposing);
        //}
    }
}
